KERNEL_DIR=/usr/src/linux-6.14
BUILD_DIR=$(shell pwd)/build
INCLUDE_DIR=$(shell pwd)/include

obj-m += custom_module.o
ccflags-y += -I${INCLUDE_DIR}
all : modules test
dtb :
	dtc -@ -I dts -O dtb -o custom_module_type_1.dtbo custom_module_type_1.dts
modules :
	make -C ${KERNEL_DIR} M=$(shell pwd) modules
clean :
	make -C ${KERNEL_DIR} M=$(shell pwd) clean
	rm -rfv $(shell pwd)/custom_module_test
	rm -rfv $(shell pwd)/*.dtbo $(shell pwd)/*.dtb
test :
	gcc custom_module_test.c -o custom_module_test -Og -g -I${INCLUDE_DIR}